package com.lx.oms.controller.manager.impl;

import java.math.BigInteger;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.utils.Utils;
import com.lx.oms.controller.dao.QuotationPriceMapper;
import com.lx.oms.controller.entity.QuotationPriceEntity;
import com.lx.oms.controller.manager.QuotationPriceManager;

/**
 * 行情价格
 *
 * @author houzhong
 * @date 2018年7月12日 下午2:41:51
 */
@Component("quotationPriceManager")
public class QuotationPriceManagerImpl implements QuotationPriceManager {

	@Autowired
	private QuotationPriceMapper quotationPriceMapper;
	

	@Override
	public List<QuotationPriceEntity> listQuotationPrice(Page<QuotationPriceEntity> page, Query search) {
		return quotationPriceMapper.listForPage(page, search);
	}

	@Override
	public int saveQuotationPrice(QuotationPriceEntity quotationPrice) {
		if (quotationPrice.getId() == null) {
			quotationPrice.setId(Utils.id().toString());
		}
		return quotationPriceMapper.save(quotationPrice);
	}

	@Override
	public QuotationPriceEntity getQuotationPriceById(BigInteger id) {
		QuotationPriceEntity quotationPrice = quotationPriceMapper.getObjectById(id);
		return quotationPrice;
	}

	@Override
	public int updateQuotationPrice(QuotationPriceEntity quotationPrice) {
		return quotationPriceMapper.update(quotationPrice);
	}

	@Override
	public int batchRemove(String[] id) {
		int count = quotationPriceMapper.batchRemove(id);
		return count;
	}
	
}
